<template>
  <div style="height: 100%; width: 100%; position: relative">
      <div class="pagetop">
          <div style="width: 100%">
              <el-col>
                  <div ref="buttondiv">
                      <table style="width: 100%">
                          <tr>
                              <td>{{datename}}</td>
                              <td>
                                  <table>
                                      <tr>
                                          <td>
                                              <el-date-picker v-model="strdate" type="date" align="right" value-format="yyyy-MM-dd 00:00:00" size="mini" placeholder="开始日期" :clearable="false" style="width: 125px"></el-date-picker> -
                                          </td>
                                          <td>
                                              <el-date-picker v-model="enddate" type="date" align="right" value-format="yyyy-MM-dd 23:59:59" size="mini" placeholder="结束日期" :clearable="false" style="width: 125px"></el-date-picker>
                                          </td>
                                      </tr>
                                  </table>
                              </td>
                              <td>检验工作组</td>
                              <td>
                                  <el-select v-model="labgroup" @dblclick.native="popMultipleChk(labgroup,'labgroup',labgroupOption,'请选择检验组别')" filterable clearable style="width:120px">
                                      <el-option v-for="(item,index) in labgroupOption" :key="index" :value="item.data" :label="item.display"></el-option>
                                  </el-select>
                              </td>
                              <td style="width:70px">项目组合</td>
                              <td colspan="2">
                                  <rm-ddl-common datatype="reportitemcomb" dataname="项目组合" kindno="2" v-model="combid" width="200px" @change="combChange"></rm-ddl-common>
                              </td>
                              <td width="2000"></td>
                              <!-- <td>检验医院</td>
                              <td>
                                  <rm-ddl-common datatype="hospital" dataname="检验医院" v-model="labhospital" width="100%"></rm-ddl-common>
                              </td>
                              <td>检验科室</td>
                              <td>
                              </td>
                              <td>病人来源</td>
                              <td>
                                  <rm-ddl-common datatype="seccode" kindno="PT" dataname="病人来源" v-model="pattype" width="120px"></rm-ddl-common>
                              </td> -->
                          </tr>
                          <tr>
                              <td>统计类别</td>
                              <td>
                                  <el-select v-model="unitkind" style="width: 100%">
                                      <el-option label="检验工作组" value="0"></el-option>
                                      <el-option label="报告单元组合(标本可接收性)" value="1"></el-option>
                                      <el-option label="报告单元组合(检验报告)" value="2"></el-option>
                                      <el-option label="报告单元组合(周转时间)" value="3"></el-option>
                                  </el-select>
                              </td>
                              <!-- <td colspan="2">
                                  <el-checkbox v-model="nobarcoderpt" false-label="0" true-label="1" style="font-size: 12px">剔除无条码的报告</el-checkbox>
                                  <el-checkbox v-model="timenobody" false-label="0" true-label="1" style="font-size: 12px">周转时间统计体检数据</el-checkbox>
                              </td> -->
                              <td>检验科室</td>
                              <td>
                                  <el-select v-model="labdept" @dblclick.native="popMultipleChk(labdept,'labdept',labdeptOption,'请选择检验科室')" filterable clearable style="width:120px">
                                      <el-option v-for="(item,index) in labdeptOption" :key="index" :value="item.data" :label="item.display"></el-option>
                                  </el-select>
                              </td>
                              <td>病人类型</td>
                              <td>
                                  <el-select v-model="pattype" @dblclick.native="popMultipleChk(pattype,'pattype',pattypeOption,'请选择病人类型')" filterable clearable style="width:200px">
                                      <el-option v-for="(item,index) in pattypeOption" :key="index" :value="item.data" :label="item.display"></el-option>
                                  </el-select>
                              </td>
                              <!-- <td>项目组合</td>
                              <td>
                                  <rm-ddl-common datatype="reportitemcomb" dataname="项目组合" v-model="combid" width="120px"></rm-ddl-common>
                              </td> -->
                              <!-- <td>申请科室</td>
                              <td>
                                  <rm-ddl-common datatype="dept" dataname="申请科室" v-model="reqdept" width="120px"></rm-ddl-common>
                              </td> -->
                          </tr>
                          <tr>
                              <td colspan="3">
                                  <el-checkbox true-label="1" false-label="0" v-model="chk_notnamecode">无姓名</el-checkbox>
                                  <el-checkbox true-label="1" false-label="0" v-model="chk_notdepartmentcode">无申请科室</el-checkbox>
                                  <el-checkbox true-label="1" false-label="0" v-model="chk_reqsource">实验室开单</el-checkbox>
                                  <el-checkbox true-label="1" false-label="0" v-model="chk_notbarcode">无条码号</el-checkbox>
                                  <span style="font-weight:bold"> 的不统计</span>
                              </td>
                              <td colspan="3" style="text-align: right">
                                  <div style="margin-left: 10px">
                                      危急值规定通报时间
                                      <el-input v-model="alerttime" style="width: 30px"></el-input>
                                      分钟
                                  </div>
                              </td>
                              <td colspan="8" style="text-align: right">
                                  <el-button icon="el-icon-search" type="primary" @click="Query()">查询</el-button>
                                  <el-button icon="el-icon-search" @click="exportExcel()">导出</el-button>
                              </td>
                          </tr>
                      </table>
                  </div>
              </el-col>
          </div>
      </div>
      <div class="pagecenter">
          <div style="height: 100%">
              <rm-layout-left splitcolor="#F8F8FF" movingcolor="#ccc" :splitwidth="3" :fixsize="205" :minfixsize="80">
                  <div style="height: 100%; width: 100%; border: 1px solid #ccc">
                      <vxe-table :data.sync="tableDataRight" :loading="loadingRight" height="auto" resizable border header-align="center" show-overflow="tooltip" show-header-overflow="tooltip" size="mini" stripe ref="xTable" :cell-class-name="cellClassName" :edit-config="{trigger: 'dblclick', mode: 'cell'}" @cell-dblclick="DblEvent">
                          <vxe-table-column :field="item.field" :title="item.title" :width="item.width" :key="item.field" v-for="item in RightColumn" :fixed="item.colIndex==0?'left':''">
                              <template v-slot="{ row }" v-if="item.field != 'statname'">
                                  <div v-if="item.field != 'perc'">{{ row[item.field] ? row[item.field] : "0" }}</div>
                                  <div v-else>{{ row[item.field] ? row[item.field] * 100 + "%" : "0" }}</div>
                              </template>
                              <template v-slot="{ row }" v-else>
                                  <div v-if="row.hasOwnProperty('topspace') && row.topspace >0"><span :key="count" v-for="count in row.topspace">&ensp;</span>{{ row.statname }}</div>
                                  <div v-else>{{ row.statname }}</div>
                              </template>
                          </vxe-table-column>
                      </vxe-table>
                  </div>
                  <template v-slot:fix>
                      <div style="height: 100%">
                          <vxe-table :data.sync="tableData" @current-change="currentChangeEvent" :tree-config="{ children: 'children', expandAll: true }" height="auto" highlight-current-row resizable border header-align="center" show-overflow="tooltip" show-header-overflow="tooltip" :show-header="false" size="mini" stripe ref="xTableMenu">
                              <vxe-table-column field="menuname" title="" width="200px" tree-node></vxe-table-column>
                          </vxe-table>
                      </div>
                  </template>
              </rm-layout-left>
              <!-- <vxe-table :data.sync="tableData" :edit-config="{trigger: 'click', mode: 'cell',showStatus: true,showIcon: false}" :loading="loading" @current-change="currentChangeEvent" height="auto" highlight-current-row resizable border header-align="center" show-overflow="tooltip" show-header-overflow="tooltip" size="mini" stripe ref="xTable">
                  <vxe-table-column field="menuevent" title="菜单方法" width="200px" :edit-render="{name: 'input', autoselect: true}"></vxe-table-column>
                  <vxe-table-column field="menuextname" title="原始名称" width="200px" :edit-render="{name: 'input', autoselect: true}"></vxe-table-column>
                  <vxe-table-column field="menuname" title="菜单名称" :edit-render="{name: 'input', autoselect: true}" width="200px"></vxe-table-column>
                  <vxe-table-column field="menukey" title="快捷键" :edit-render="{name: 'input', autoselect: true}" width="80px" align="center"></vxe-table-column>
                  <vxe-table-column field="menuseq" title="序号" width="60px" align="center"></vxe-table-column>
                  <vxe-table-column field="menunote" title="帮助说明" :edit-render="{name: 'input', autoselect: true}" width="160px"></vxe-table-column>
              </vxe-table> -->
          </div>
          <!--多选弹窗--->
          <el-dialog width="900px" v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="multichktitle" :visible.sync="dialogMultipleVisible" :destroy-on-close="true">
              <rm-SqlMultiple :leftOption="option1" :rightOption="option2" :name="fieldname" @change="closedialog"></rm-SqlMultiple>
          </el-dialog>

          <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="poptitle" :visible.sync="dialogNotimpdetail" width="1000px">
              <div style="height: 500px">
                  <rm-layout-left splitcolor="#ffffff" :splitwidth="2" :fixsize="675" :minfixsize="200" ref="layoutright">
                      <template v-slot:fix>
                          <div style="height: 100%">
                              <vxe-table :data.sync="NotimpTableData" :select-config="{ reserve: true }" :loading="dialogloading" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row how-header-overflow ref="NotimppopTable" resizable show-overflow size="mini" stripe show-header-overflow header-align="center" show-footer @current-change="rptchange_Event">
                                  <vxe-table-column field="emer_flag" title="急 " width="30" header-align="center" align="center">
                                      <template v-slot="{ row }">
                                          <div style="color: red">{{ row.emer_flag == "1" ? "急" : "" }}</div>
                                      </template>
                                  </vxe-table-column>
                                  <vxe-table-column field="pat_typecodename" sortable title="病人类别" width="65" show-overflow></vxe-table-column>
                                  <vxe-table-column field="sampleno" sortable title="标本号" width="100" show-overflow></vxe-table-column>
                                  <vxe-table-column field="sampledate" sortable title="标本日期" width="70" :formatter="['toDateString', 'yyyy-MM-dd']" show-overflow></vxe-table-column>
                                  <vxe-table-column field="specimen_name" sortable title="标本类型" width="100" show-overflow></vxe-table-column>
                                  <vxe-table-column field="barcode" sortable title="条码号" width="100" show-overflow></vxe-table-column>
                                  <vxe-table-column field="pat_name" sortable title="姓名" width="70" show-overflow></vxe-table-column>
                                  <vxe-table-column field="pat_sexname" sortable title="性别" width="40" show-overflow></vxe-table-column>
                                  <vxe-table-column field="pat_agestr" sortable title="年龄岁数" width="70" show-overflow></vxe-table-column>
                                  <vxe-table-column field="deptname" sortable title="科室" width="130" show-overflow></vxe-table-column>
                                  <vxe-table-column field="wardname" sortable title="病区" width="130" show-overflow></vxe-table-column>
                                  <vxe-table-column field="rechk_dt" sortable title="审核时间" width="120" show-overflow></vxe-table-column>
                                  <vxe-table-column field="req_reason" sortable title="申请项目" width="160" show-overflow></vxe-table-column>
                                  <vxe-table-column field="reportid" sortable title="报告ID" width="110" show-overflow></vxe-table-column>
                              </vxe-table>
                          </div>
                      </template>
                      <div style="height: 100%">
                          <vxe-table ref="rptdetailtable" :data.sync="rptdetailtabledata" :select-config="{ reserve: true }" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row highlight-hover-column highlight-hover-row how-header-overflow resizable show-overflow size="mini" show-header-overflow :optimization="{ animat: false }" header-align="center">
                              <vxe-table-column :field="items.field" :key="items.field" :title="items.title" :width="items.width" sortable v-for="items in rptdetailColumn"></vxe-table-column>
                          </vxe-table>
                      </div>
                  </rm-layout-left>
              </div>
              <span slot="footer" class="dialog-footer">
                  <el-button @click="dialogNotimpdetail = false">关 闭</el-button>
                  <el-button icon="el-icon-download" @click="exportpopExcel(1)">导出内容</el-button>
              </span>
          </el-dialog>
          <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" :title="refusepoptitle" :visible.sync="dialogRefusedetail" width="1000px">
              <div style="height: 500px">
                  <vxe-table :data.sync="RefuseTableData" :select-config="{ reserve: true }" :loading="refuseloading" :sort-config="{ trigger: 'cell' }" border height="auto" highlight-current-row class="mytable-style" highlight-hover-column highlight-hover-row how-header-overflow ref="RefusepopTable" resizable show-overflow size="mini" stripe show-header-overflow header-align="center" show-footer>
                      <vxe-table-column field="barcode" sortable title="条码号" width="100" show-overflow></vxe-table-column>
                      <!-- <vxe-table-column field="sampledate" sortable title="标本日期" width="70" :formatter="['toDateString', 'yyyy-MM-dd']" show-overflow ></vxe-table-column> -->
                      <vxe-table-column field="specimen_name" sortable title="标本类型" width="80" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_name" sortable title="姓名" width="70" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_sexname" sortable title="性别" width="40" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_agestr" sortable title="年龄岁数" width="60" show-overflow></vxe-table-column>
                      <vxe-table-column field="deptname" sortable title="科室" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="wardname" sortable title="病区" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="pat_typecodename" sortable title="病人类别" width="60" show-overflow></vxe-table-column>
                      <vxe-table-column field="codena" sortable title="退回原因" width="100" show-overflow></vxe-table-column>
                      <vxe-table-column field="emer_flag" title="加急 " width="40" header-align="center" align="center">
                          <template v-slot="{ row }">
                              <div style="color: red">{{ row.emer_flag == "1" ? "急" : "" }}</div>
                          </template>
                      </vxe-table-column>
                      <vxe-table-column field="sampled_username" sortable title="采样人" width="65" show-overflow></vxe-table-column>
                      <vxe-table-column field="reject_username" sortable title="退回人" width="65" show-overflow></vxe-table-column>
                      <vxe-table-column field="req_reason" sortable title="送检目的" width="100" show-overflow></vxe-table-column>
                  </vxe-table>
              </div>
              <span slot="footer" class="dialog-footer">
                  <el-button @click="dialogRefusedetail = false">关 闭</el-button>
                  <el-button icon="el-icon-download" @click="exportpopExcel(2)">导出内容</el-button>
              </span>
          </el-dialog>
          <el-dialog v-el-drag-dialog :append-to-body="true" :close-on-click-modal="false" title="提示" :visible.sync="remindVisible" width="450px">
              <div style="height: 100px">
                  <span style="font-size: 20px;color:blue;">因为有报告单元从属于多个报告单元组合，请以实际总数和实际百分比数据为准！</span>
              </div>
              <span slot="footer" class="dialog-footer">
                  <el-checkbox v-model="noremindflag" style="font-size: 12px; margin-right:30px;">本次打开不再提醒</el-checkbox>
                  <el-button @click="remindVisible = false">确定</el-button>
              </span>
          </el-dialog>

      </div>
  </div>
</template>

<script>
// import { request } from "http";
import XEUtils from "xe-utils";
export default {
  name: "LIS615",
  data() {
      return {
          strdate: "", //开始日期
          enddate: "", //结束日期
          labhospital: "", //检验医院
          labdept: "", //检验科室
          labgroup: "", //检验工作组
          pattype: "", //病人类型
          unitkind: "0", //统计类别
          nobarcoderpt: "0", //删除无条码
          timenobody: "0",
          alerttime: "60",
          reqdept: "",
          combid: "",
          currentrow: {},
          rptunitid: 0,
          tableData: [
              {
                  menuname: "检验全过程质量指标",
                  children: [
                      { value: "req_receive", menuname: "标本可接受性" },
                      { value: "lis_report", menuname: "检验报告" },
                      { value: "turnover", menuname: "周转时间" },
                      { value: "turnoveritem", menuname: "周转时间(具体项目)" },
                      { value: "bloodculture", menuname: "血培养污染" },
                      { value: "req", menuname: "申请单" },
                      { value: "bact", menuname: "微生物标本污染" },
                      { value: "labresult", menuname: "检验结果" },
                      { value: "others", menuname: "其他数据" },
                  ],
              },
          ],
          tableDataRight: [], //右侧数据
          loadingRight: false, //右侧数据显示加载
          RightColumn: [{ field: "", title: "", width: "100px", colIndex: -1 }],
          DelIndex: -1,
          currentindex: 0,
          CopyShow: false,
          rptunitidcopy: 0,
          fileheader: "",
          Firstloading: true,
          chk_notnamecode: "0",
          chk_notdepartmentcode: "0",
          chk_reqsource: "0",
          chk_notbarcode: "0",
          datename: "样本日期",
          dialogMultipleVisible: false,
          option1: [],
          option2: [],
          fieldname: "",
          multichktitle: "",
          labgroupOption: [],
          labdeptOption: [],
          pattypeOption: [],
          dialogNotimpdetail: false,
          dialogloading: false,
          NotimpTableData: [],
          poptitle: "",
          refusepoptitle: "",
          refuseloading: false,
          RefuseTableData: [],
          dialogRefusedetail: false,
          rptdetailColumn: [],
          rptdetailtabledata: [],
          noremindflag: false,
          remindVisible: false,
          exportTableColLen: 0,
          combname: "",
      };
  },
  computed: {},
  watch: {},
  created() {
      this.InitData();
  },
  mounted() {
      this.InitOptions();
  },
  updated() {},
  methods: {
      rptchange_Event({ row, rowIndex, column, columnIndex }, event) {
          this.queryrptResult(row);
      },
      popMultipleChk(e, fieldname, option, title) {
          let temp = XEUtils.clone(option, true);
          this.option1 = [];
          this.option2 = [];
          if (e != "") {
              let k = e.split(",");
              k.forEach((item) => {
                  let ndata = temp.find((m) => m.data == item);
                  if (ndata != undefined && ndata != null) {
                      this.option2.push(ndata);
                  }
              });
              temp.forEach((item) => {
                  if (k.indexOf(item.data + "") < 0) {
                      this.option1.push(item);
                  }
              });
          } else {
              this.option1 = temp;
          }
          this.fieldname = fieldname;
          this.multichktitle = title;
          this.dialogMultipleVisible = true;
      },
      closedialog(value, name) {
          if (value != "close") {
              this[name] = value;
          }
          this.dialogMultipleVisible = false;
      },
      InitData() {
          this.$tool
              .request({
                  url: "LIS/LIS6/LIS615",
                  method: "post",
                  timeout: 900000,
                  data: {
                      action: "InitData",
                  },
              })
              .then((res) => {
                  this.labgroupOption = res.labgroupOption;
                  this.pattypeOption = res.pattypeOption;
                  this.labdeptOption = res.labdeptOption;
              })
              .catch((e) => {
                  this.$alert(e, "提示");
              });
      },
      InitOptions() {
          let date = this.$pub.InitDate();
          this.strdate = date + " 00:00:00";
          this.enddate = date + " 23:59:59";
          this.Query("req_receive");
      },
      setDateNameShow(typecode) {
          this.datename = "样本日期";
          if (typecode == "bloodculture") {
              this.datename = "签收日期";
          }
      },
      currentChangeEvent({ row, rowIndex }) {
          this.currentindex = rowIndex;
          this.currentrow = row;
          this.setDateNameShow(row.value);
          //this.Query(row.value);
      },
      Query(value) {
          let row = {};
          if (value) row = {};
          else row = this.$refs.xTableMenu.getCurrentRow();
          if (this.Firstloading) {
              this.$refs.xTableMenu.setCurrentRow(this.$refs.xTableMenu.tableFullData[0].children[0]);
              this.currentrow = this.$refs.xTableMenu.getCurrentRow();
              this.Firstloading = false;
              return;
          }
          if (row && !row.hasOwnProperty("children")) {
              this.loadingRight = true;
              this.$tool
                  .request({
                      url: "LIS/LIS6/LIS615",
                      method: "post",
                      timeout: 1800000,
                      data: {
                          action: "query",
                          date1: this.strdate,
                          date2: this.enddate,
                          unitkind: this.unitkind,
                          typecode: value ? value : row.value,
                          labhospitalcode: this.labhospital,
                          labdept: this.labdept,
                          labgroupid: this.labgroup,
                          pattypecode: this.pattype,
                          nobarcoderpt: this.nobarcoderpt,
                          timenobody: this.timenobody,
                          alerttime: this.alerttime,
                          combid: this.combid,
                          reqdept: this.reqdept,
                          chk_notnamecode: this.chk_notnamecode,
                          chk_notdepartmentcode: this.chk_notdepartmentcode,
                          chk_reqsource: this.chk_reqsource,
                          chk_notbarcode: this.chk_notbarcode,
                      },
                  })
                  .then((res) => {
                      this.loadingRight = false;
                      if (res && res.errcode == "1") {
                          //this.tableData = res.data;
                          this.DealColumn(res.Data);
                          if (res.Data.length > 1) {
                              this.tableDataRight = res.Data.splice(1, res.Data.length - 1);
                              if (res.Data[0].hasOwnProperty("realamount") && !this.noremindflag) this.remindVisible = true;
                          } else {
                              this.tableDataRight = [];
                          }
                      } else {
                          this.$alert(res.errmsg, "提示");
                          this.tableDataRight = [];
                      }
                  })
                  .catch((e) => {
                      this.loadingRight = false;
                      this.tableDataRight = [];
                      this.$alert(e, "提示");
                  });
          } else {
              this.$alert("请选择要查询的质量指标", "提示");
          }
      },
      DealColumn(data) {
          this.RightColumn = [];
          if (data.length > 0) {
              let column = data[0];
              for (let col in data[0]) {
                  if (col == "statname") this.RightColumn.push({ field: col, title: data[0]["statname"], width: this.CalcWidth(data), colIndex: 0 });
              }
              for (let col in data[0]) {
                  if (col != "statname" && col != "cnt" && col != "perc" && col != "turnovercnt" && col != "statid" && col != "stattag" && col != "topspace") {
                      if (data[0][col].length > 6) this.RightColumn.push({ field: col, title: data[0][col], width: data[0][col].length * 12 + "px" });
                      else this.RightColumn.push({ field: col, title: data[0][col], width: "80px", colIndex: 1 });
                  }
              }
              if (data[0].hasOwnProperty("cnt")) this.RightColumn.push({ field: "cnt", title: "总计", width: "60px", colIndex: 1 });
              if (data[0].hasOwnProperty("perc")) this.RightColumn.push({ field: "perc", title: "百分比%", width: "60px", colIndex: 1 });
              if (data[0].hasOwnProperty("turnovercnt")) this.RightColumn.push({ field: "turnovercnt", title: "总计", width: "60px", colIndex: 1 });
          }
      },
      CalcWidth(data) {
          let width = 120;
          for (let i = 0; i < data.length; i++) {
              if (data[i].statname.length * 12 >= width) width = data[i].statname.length * 12 + 6;
          }
          return width + "px";
      },
      exportExcel() {
          let filtertxt = this.getExportFilter();
          let data = this.getExportData();
          this.$pub.exportTableExcelWithData(data, this.exportTableColLen, "LIS615 检验指标上报-" + this.fileheader + " .xlsx", filtertxt, "统计条件：");
      },
      getExportData(type) {
          let datas = [];
          this.fileheader = "";
          datas = this.$refs.xTable.afterFullData;
          var allcolumns = this.$refs.xTable.getColumns();
          var tableColumn = [];
          for (let i = 0; i < allcolumns.length; i++) {
              if (i == 0) {
                  // allcolumns[0].title = this.currentrow.menuname;
                  tableColumn.push({
                      field: allcolumns[i].property,
                      title: this.currentrow.menuname,
                  });
              } else {
                  tableColumn.push({
                      field: allcolumns[i].property,
                      title: allcolumns[i].title,
                  });
              }
          }
          this.fileheader = this.currentrow.menuname;
          this.exportTableColLen = tableColumn.length;
          let columns = tableColumn.filter((item) => item.field);
          let headers = [columns.map((item) => item.title)];
          return headers.concat(
              datas.map((row) => {
                  return columns.map((column) => {
                      return row[column.field];
                  });
              })
          );
      },
      DblEvent({ row, rowIndex, $rowIndex, column }) {
          if (this.currentrow.value == "lis_report" && (row.statname == "其中不正确检验报告数" || row.statname == "      其中解审修改检验报告数" || row.statname == "      危急值通报超过医院规定时间数" || row.statname == "      其中超过规定时间发送的检验报告数" || row.statname == "      危急值未通报数")) {
              this.NotimpTableData = [];
              this.rptdetailColumn = [];
              this.rptdetailtabledata = [];
              this.poptitle = row.statname + "详情-" + column.title;
              this.dialogNotimpdetail = true;
              var groupid = column.property;
              this.dialogloading = true;
              //弹窗显示。
              this.$tool
                  .request({
                      url: "LIS/LIS6/LIS615",
                      method: "post",
                      timeout: 1800000,
                      data: {
                          action: "notimplist",
                          date1: this.strdate,
                          date2: this.enddate,
                          unitkind: this.unitkind,
                          typecode: "lis_report",
                          statname: row.statname,
                          labhospitalcode: this.labhospital,
                          labdeptcode: this.labdept,
                          labgroupid: this.labgroup,
                          pattypecode: this.pattype,
                          nobarcoderpt: this.nobarcoderpt,
                          timenobody: this.timenobody,
                          alerttime: this.alerttime,
                          combid: this.combid,
                          reqdept: this.reqdept,
                          chk_notnamecode: this.chk_notnamecode,
                          chk_notdepartmentcode: this.chk_notdepartmentcode,
                          chk_reqsource: this.chk_reqsource,
                          chk_notbarcode: this.chk_notbarcode,
                          groupid: groupid,
                      },
                  })
                  .then((res) => {
                      this.NotimpTableData = res.data;
                      this.dialogloading = false;
                      this.$nextTick(() => {
                          this.$refs.NotimppopTable.setCurrentRow(res.data[0]);
                          this.queryrptResult(res.data[0]);
                      });
                  })
                  .catch((e) => {});
          } else if (this.currentrow.value == "req_receive") {
              let rejectclassno = "";
              let specimentype = "";
              if (row.statname.indexOf("需抗凝") > -1) {
                  //排除需抗凝
                  return false;
              }
              if (row.statname.indexOf("错误") > -1 || row.statname.indexOf("抗凝") > -1 || row.statname.indexOf("丢失") > -1 || row.statname.indexOf("溶血") > -1 || row.statname.indexOf("标签") > -1 || row.statname.indexOf("标本采集") > -1 || row.statname.indexOf("运输") > -1|| row.statname.indexOf("储存") > -1 ) {
                  if (!parseInt(row[column.property])) {
                      return false;
                  }
                  switch (row.statname) {
                      case "其中标本类型错误的标本总数":
                      case "其中标本类型错误的血标本数":
                      case "其中标本类型错误的体液标本数":
                      case "其中标本类型错误的其他标本数":
                          rejectclassno = "specimen";
                          break;
                      case "容器错误的标本总数":
                      case "容器错误的血标本数":
                      case "容器错误的体液标本数":
                      case "容器错误的其他标本数":
                          rejectclassno = "container";
                          break;
                      case "采集量错误的标本总数":
                      case "采集量错误的血标本数":
                      case "采集量错误的体液标本数":
                      case "采集量错误的其他标本数":
                          rejectclassno = "insufficient";
                          break;
                      case "抗凝标本凝集总数":
                      case "抗凝血标本凝集数":
                      case "抗凝体液标本凝集数":
                      case "抗凝其他标本凝集数":
                          rejectclassno = "Agglutination";
                          break;
                      case "丢失的标本数总数":
                      case "丢失的血标本数":
                      case "丢失的体液标本数":
                      case "丢失的其他标本数":
                          rejectclassno = "lost";
                          break;
                      case "溶血的标本数":
                          rejectclassno = "hemolysis";
                          break;
                      case "标签不合格的标本数":
                          rejectclassno = "label";
                          break;
                      case "标本采集时机不正确":
                          rejectclassno = "collect";
                          break;
                      case "运输温度不合理的标本数":
                          rejectclassno = "transportation_temperature";
                          break;
                      case "运输时间不合理的标本数":
                          rejectclassno = "transportation_time";
                          break;
                      case "运输途中被破坏的标本数":
                          rejectclassno = "transportation_damage";
                          break;
                      case "检验前储存不适当的标本数":
                          rejectclassno = "storage_damage";
                          break;
                  }
                  switch (row.statname) {
                      case "其中标本类型错误的血标本数":
                      case "容器错误的血标本数":
                      case "采集量错误的血标本数":
                      case "抗凝血标本凝集数":
                      case "丢失的血标本数":
                          specimentype = "02";
                          break;
                      case "其中标本类型错误的体液标本数":
                      case "容器错误的体液标本数":
                      case "采集量错误的体液标本数":
                      case "抗凝体液标本凝集数":
                      case "丢失的体液标本数":
                          specimentype = "03";
                          break;
                      case "其中标本类型错误的其他标本数":
                      case "容器错误的其他标本数":
                      case "采集量错误的其他标本数":
                      case "抗凝其他标本凝集数":
                      case "丢失的其他标本数":
                          specimentype = "09";
                          break;
                  }
                  this.refusepoptitle = row.statname + "详情-" + column.title;
                  this.dialogRefusedetail = true;
                  var groupid = column.property;
                  this.refuseloading = true;
                  //弹窗显示。
                  this.$tool
                      .request({
                          url: "LIS/LIS6/LIS615",
                          method: "post",
                          timeout: 1800000,
                          data: {
                              action: "receiverefuse",
                              date1: this.strdate,
                              date2: this.enddate,
                              unitkind: this.unitkind,
                              typecode: "req_receive",
                              labhospitalcode: this.labhospital,
                              labdeptcode: this.labdept,
                              labgroupid: this.labgroup,
                              pattypecode: this.pattype,
                              nobarcoderpt: this.nobarcoderpt,
                              timenobody: this.timenobody,
                              alerttime: this.alerttime,
                              combid: this.combid,
                              reqdept: this.reqdept,
                              chk_notnamecode: this.chk_notnamecode,
                              chk_notdepartmentcode: this.chk_notdepartmentcode,
                              chk_reqsource: this.chk_reqsource,
                              chk_notbarcode: this.chk_notbarcode,
                              groupid: groupid,
                              rejectclassno: rejectclassno,
                              specimentype: specimentype,
                          },
                      })
                      .then((res) => {
                          this.RefuseTableData = XEUtils.clone(res.data, true);
                          this.refuseloading = false;
                      })
                      .catch((e) => {});
              }
          } else if (this.currentrow.value == "bloodculture" && row.statname == "血培养污染瓶数") {
              this.refusepoptitle = row.statname + "详情-" + column.title;
              this.dialogRefusedetail = true;
              var groupid = column.property;
              this.refuseloading = true;
              //弹窗显示。
              this.$tool
                  .request({
                      url: "LIS/LIS6/LIS615",
                      method: "post",
                      timeout: 1800000,
                      data: {
                          action: "bloodcultureDetail",
                          date1: this.strdate,
                          date2: this.enddate,
                          unitkind: this.unitkind,
                          typecode: "bloodculture",
                          labhospitalcode: this.labhospital,
                          labdeptcode: this.labdept,
                          labgroupid: this.labgroup,
                          pattypecode: this.pattype,
                          nobarcoderpt: this.nobarcoderpt,
                          timenobody: this.timenobody,
                          alerttime: this.alerttime,
                          combid: this.combid,
                          reqdept: this.reqdept,
                          chk_notnamecode: this.chk_notnamecode,
                          chk_notdepartmentcode: this.chk_notdepartmentcode,
                          chk_reqsource: this.chk_reqsource,
                          chk_notbarcode: this.chk_notbarcode,
                          groupid: groupid,
                      },
                  })
                  .then((res) => {
                      this.RefuseTableData = XEUtils.clone(res.data, true);
                      this.refuseloading = false;
                  })
                  .catch((e) => {});
          }
      },
      //添加不正确标本操作明细
      queryrptResult(row) {
          this.$tool
              .request({
                  url: "LIS/LIS6/LIS615",
                  method: "post",
                  data: {
                      action: "queryrptResult",
                      reportid: row.reportid,
                  },
              })
              .then((res) => {
                  this.rptdetailColumn = res.RData.Cols;
                  this.rptdetailtabledata = res.RData.Data;
                  // this.$nextTick(() => {
                  //     this.$refs.rpttable.setCurrentRow(res.RData.Data[0]);
                  // });
              })
              .catch((e) => {});
      },
      cellClassName({ row, column }) {
          if (this.currentrow.value == "lis_report") {
              if ((row.statname == "其中不正确检验报告数" || row.statname == "      其中解审修改检验报告数" || row.statname == "      危急值通报超过医院规定时间数" || row.statname == "      其中超过规定时间发送的检验报告数" || row.statname == "      危急值未通报数") && column.property != "statname" && column.property != "amount") {
                  if (parseInt(row[column.property]) > 0&& column.property != "pencent" && parseInt(row[column.property]) > 0) {
                      return "sample-tips";
                  }
              }
          }
          if (this.currentrow.value == "req_receive") {
              let ret = "";
              if (row.statname == "本月其他标本总数" || row.statname == "需抗凝其他标本总数" || row.statname == "其中标本类型错误的其他标本数" || row.statname == "容器错误的其他标本数" || row.statname == "采集量错误的其他标本数" || row.statname == "抗凝其他标本凝集数" || row.statname == "丢失的其他标本数") {
                  ret = "tdborder";
              }

              if (row.statname.indexOf("需抗凝") == -1) {
                  //排除需抗凝
                  if (row.statname.indexOf("错误") > -1 || row.statname.indexOf("抗凝") > -1 || row.statname.indexOf("丢失") > -1 || row.statname.indexOf("溶血") > -1 || row.statname.indexOf("标签") > -1 || row.statname.indexOf("标本采集") > -1 || row.statname.indexOf("运输") > -1|| row.statname.indexOf("储存") > -1) {
                      //console.log("column",column);
                      if (column.property != "statname" && column.property != "pencent" && parseInt(row[column.property]) > 0) {
                          ret = ret + " sample-tips";
                      }
                  }
              }
              return ret;
          }
          if (this.currentrow.value == "bloodculture") {
              if (row.statname == "血培养污染瓶数" && column.property != "statname") {
                  if (parseInt(row[column.property]) > 0) {
                      return "sample-tips";
                  }
              }
          }
      },
      combChange(code, name) {
          this.combid = code;
          this.combname = name;
      },
      exportpopExcel(type) {
          if (type == 1) {
              if (this.NotimpTableData.length > 0) {
                  let tableColumn = this.$refs.NotimppopTable.getColumns();
                  let extableColumn = [];
                  tableColumn.forEach((item) => {
                      extableColumn.push({ title: item.title, field: item.property });
                  });
                  let filtertxt = this.getExportFilter();
                  this.$pub.exportTableExcel(this.NotimpTableData, extableColumn, "BAC615 " + this.poptitle + ".xlsx", filtertxt, "统计条件：");
              } else {
                  this.$alert("暂无数据导出！");
              }
          } else if (type == 2) {
              if (this.RefuseTableData.length > 0) {
                  let tableColumn = this.$refs.RefusepopTable.getColumns();
                  let extableColumn = [];
                  tableColumn.forEach((item) => {
                      extableColumn.push({ title: item.title, field: item.property });
                  });
                  let filtertxt = this.getExportFilter();
                  this.$pub.exportTableExcel(this.RefuseTableData, extableColumn, "BAC615 " + this.refusepoptitle + ".xlsx", filtertxt, "统计条件：");
              } else {
                  this.$alert("暂无数据导出！");
              }
          }
      },
      // 获取当前导出文件的所有查询条件
      getExportFilter() {
          let filtertxt = this.datename + ":" + XEUtils.toDateString(this.strdate, "yyyy-MM-dd HH:mm:ss") + "至" + XEUtils.toDateString(this.enddate, "yyyy-MM-dd HH:mm:ss") + "; ";
          if (this.labgroup) filtertxt += "检验工作组:" + this.getOptionName(this.labgroupOption.filter((item) => ("," + this.labgroup + ",").indexOf("," + item.data + ",") > -1)) + "; ";
          if (this.combid) filtertxt += "项目组合:" + this.combname + "; ";
          if (this.unitkind) filtertxt += "统计类别:" + this.getUnitkindName() + "; ";
          if (this.pattype) filtertxt += "病人类型:" + this.getOptionName(this.pattypeOption.filter((item) => ("," + this.pattype + ",").indexOf("," + item.data + ",") > -1)) + "; ";
          if (this.labdept) filtertxt += "检验科室:" + this.getOptionName(this.labdeptOption.filter((item) => ("," + this.labdept + ",").indexOf("," + item.data + ",") > -1)) + "; ";
          if (this.alerttime) filtertxt += "危急值规定通报时间:" + this.alerttime + "分钟; ";
          let notattxt = "";
          if (this.chk_notnamecode == "1") notattxt += "无姓名、";
          if (this.chk_notdepartmentcode == "1") notattxt += "无申请科室、";
          if (this.chk_reqsource == "1") notattxt += "实验室开单、";
          if (this.chk_notbarcode == "1") notattxt += "无条码号、";
          if (notattxt) filtertxt += notattxt.substring(0, notattxt.length - 1) + "的不统计; ";
          if (this.currentrow) "检验全过程质量指标:" + this.currentrow.menuname + "; ";
          return filtertxt;
      },
      getUnitkindName() {
          let name = "";
          switch (this.unitkind) {
              case "0":
                  name = "检验工作组";
                  break;
              case "1":
                  name = "报告单元组合(标本可接收性)";
                  break;
              case "2":
                  name = "报告单元组合(检验报告)";
                  break;
              case "3":
                  name = "报告单元组合(周转时间)";
                  break;
          }
          return name;
      },
      getOptionName(option) {
          if (option && option.length > 0) {
              let optionname = "";
              option.forEach((item) => {
                  if (item.hasOwnProperty("display")) {
                      optionname += item.display + ",";
                  } else {
                      optionname += item.label + ",";
                  }
              });
              return optionname.substring(0, optionname.length - 1);
          } else {
              return "";
          }
      },
  },
};
</script>

<style scoped>
.pagetop {
  left: 0;
  right: 0;
  height: 108px;
  display: -webkit-box;
  -webkit-box-pack: center;
  -webkit-box-align: center;
  border: solid 1px #ccc;
  position: absolute;
  z-index: 99;
}

.pagecenter {
  position: absolute;
  top: 112px;
  width: 100%;
  left: 0;
  bottom: 5px;
}

.middle-left {
  position: absolute;
  height: 100%;
  width: 400px;
  left: 0px;
  top: 0;
}

.middle-center {
  position: absolute;
  height: 100%;
  left: 405px;
  right: 0;
  top: 0;
}

table tr td:nth-child(odd) {
  text-align: right;
  white-space: nowrap;
}
table tr td:nth-child(even) {
  text-align: left;
}
table tr td:nth-child(1) {
  width: 80px;
}
table {
  font-size: 12px;
  border-collapse: separate;
  border-spacing: 5px;
}

::v-deep .tdborder {
  border-bottom: 3px solid #dddddd !important;
}
::v-deep .sample-tips {
  color: blue;
  cursor: pointer;
  text-decoration: underline;
}
::v-deep .vxe-table .vxe-table--body-wrapper.fixed-left--wrapper,
.vxe-table .vxe-table--footer-wrapper.fixed-left--wrapper,
.vxe-table .vxe-table--header-wrapper.fixed-left--wrapper {
  overflow: hidden;
  left: 0;
}
</style>
